home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-04-27 | 2.6 KB | 104 lines | [TEXT/MSBB] |
- REM}|{ Required marker for end of listing!!!
- '<<< Save on internal drive as 'It', Text format.
- '<<< Delete comments to save Memory.
- SUB Rescue STATIC
- CLEAR:Peekloc!=45000!
- DIM Keep%(18)
- PRINT:PRINT "Rescue engaged!"
-
- '<<< Find location of {MERGE "It":} in memory
- ScanMem:
- Peekloc!=Peekloc!+1
- IF PEEK(Peekloc!)<>248 GOTO ScanMem
- Flag%=0:RESTORE Peekvals
- FOR I=1 TO 7
- READ J%:IF PEEK(Peekloc!+I)<>J% THEN Flag%=1
- NEXT I
- IF Flag%=1 AND Peekloc!<127*1024 GOTO ScanMem
- Peekloc!=Peekloc!-4:Begin1!=Peekloc!:Begin2!=Peekloc!
- Peekvals:
- DATA &H9E,&H20,&H22,&H49,&H74,&H22,&H3A
-
- '<<< Recover decoded values and parameters
- OPEN "Garbage Bag" AS #1 LEN=174
- FIELD #1,128 AS N$,2 AS I$,4 AS T$,2 AS L$,36 AS k$,2 AS B$
- GET #1,1
- ID$=N$:Length%=CVI(I$)
- Type$=T$:Keep%(0)=CVI(L$)
- Kp$=k$:Pre%=CVI(B$)
- CLOSE #1
- KILL "Garbage Bag"
-
- '<<< Write beginning of file
- ID$=LEFT$(ID$,Length%)+".IMOK"
- OPEN ID$ FOR OUTPUT AS #1
- PRINT #1,CHR$(Pre%);
- PRINT #1,CHR$(PEEK(Peekloc!+1));
- PRINT #1,CHR$(Keep%(0));
- PRINT #1,CHR$(PEEK(Peekloc!+3));
- FOR I%=1 TO 18
- Keep%(I%)=VAL("&H"+MID$(Kp$,2*I%-1,2))
- PRINT #1,CHR$(Keep%(I%));
- NEXT I%
- Peekloc!=Peekloc!+22:I%=0
-
- '<<< Copy file until }|{ marker is reached, then
- '<<< skip to rescue5 if Program is version 2.0
- rescue1:
- PRINT #1,CHR$(PEEK(Peekloc!));
- Peekloc!=Peekloc!+1
- IF PEEK(Peekloc!+2)<>&HAF THEN GOTO rescue1
- Flag%=1
- IF PEEK(Peekloc!+3)<>ASC("}") THEN Flag%=0
- IF PEEK(Peekloc!+4)<>ASC("|") THEN Flag%=0
- IF PEEK(Peekloc!+5)<>ASC("{") THEN Flag%=0
- IF Flag%=0 GOTO rescue1
- PRINT #1,CHR$(0);CHR$(0);
- IF Pre%>&HF7 GOTO rescue5
-
- '<<< Make listing an Odd length
- Begin1!=Peekloc!-Begin1!
- Begin1!=Begin1!-1000*INT(Begin1!/1000)
- IF (1 AND INT(Begin1!))=0 THEN PRINT #1,CHR$(0);
-
- '<<< Find end of variable names using: TenZZZ...Z
- '<<< This var MUST NOT appear anywhere else:
- TenZZZZZZZZZZ=0
- rescue3:
- Peekloc!=Peekloc!+1
- IF PEEK(Peekloc!)<>ASC("Z") GOTO rescue3
- Flag%=1
- FOR I%=1 TO 9
- IF PEEK(Peekloc!+I%)<>ASC("Z") THEN Flag%=0
- NEXT I%
- IF Flag%=0 GOTO rescue3
- J=Peekloc!+10
-
- '<<< Backtrack to start of variables list.
- rescue4:
- Peekloc!=Peekloc!-1
- IF PEEK(Peekloc!-1)<>&H0 GOTO rescue4
- J=J-Peekloc!-4
-
- '<<< If total listing is odd, skip first position.
- Begin2!=Peekloc!-Begin2!
- Begin2!=Begin2!-1000*INT(Begin2!/1000)
- IF (1 AND INT(Begin2!))=0 THEN Peekloc!=Peekloc!+1
-
- '<<< Print Variables table, EXCEPT: TenZ...ZZ
- WHILE J>1
- PRINT #1,CHR$(PEEK(Peekloc!));
- Peekloc!=Peekloc!+1:J=J-1
- WEND
-
- rescue5:
- PRINT "Voil"+CHR$(136)+"! Rescue Completed!"
- CLOSE #1
- NAME ID$ AS ID$,Type$
- PRINT "Now loading into memory."
- PRINT "Recommend you first use"
- PRINT "'Save As' to save file...";
- BEEP:FOR I%=1 TO 20000:NEXT I%
- LOAD ID$
- END SUB
-